<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    img{
      width: 500px;
      height: 500px;
    }
    
  </style>
</head>
<body>
  <img src="images/" alt="">
<script>
  function fn (N,M){
  const ran = Math.floor(Math.random()*(M - N + 1)+ N)
  }
  const ran = fn(1,6)

  const img = document.querySelector('img')
  img.src = `images/${ran}.webp`
</script>
</body>
</html>